import java.util.Random;

public class demo3 {
    public static void main(String[] args) {
        //首先定义一个数组
        int[] arry = new int[10];
        //创建一个随机数对象
        Random r = new Random();
        //定义一个变量sum
        int sum = 0;
        for (int i = 0; i < arry.length; i++) {
            arry[i] = r.nextInt(100)+1;
        }

        for (int i = 0; i < arry.length; i++) {
            sum += arry[i];
        }

        System.out.println("数组的和为：" + sum);

        //求平均数
        int avg = sum / arry.length;
        System.out.println("数组的平均数为：" + avg);

        //有多少数据比平均数小

        int count = 0;
        for (int i = 0; i < arry.length; i++) {
            if (arry[i] < avg) {
                count++;
            }
        }

        System.out.println("该数组中有："+ count +"个数据比平均数小");

        for (int i = 0; i < arry.length; i++) {
            System.out.print(arry[i]+ " ");
        }
    }
}
